package com.lovo.controller;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.lovo.bean.Suppliermsg;
import com.lovo.bean.Tenderinfo;
import com.lovo.service.ISuppliermsgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author lovo
 * @since 2022-09-17
 */
@RestController
@RequestMapping("supplier/suppliermsg")
public class SuppliermsgController {

    @Autowired
    private ISuppliermsgService suppliermsgService;


    @GetMapping("findAllMsg/{pageNO}/{supplierId}")
    public IPage<Suppliermsg> findAllMsg(@PathVariable("pageNO") Integer pageNO, @PathVariable("supplierId") Integer supplierId) {
        return suppliermsgService.findAllMsg(pageNO, supplierId);
    }


    @PutMapping("updateStatus/{id}/{status}")
    public String updateStatus(@PathVariable("id") Integer id, @PathVariable("status") String status) {
        suppliermsgService.updateStatus(id, status);
        return "ok";
    }

    @GetMapping("addMsg/{tenderId}/{size}/{batch}/{address}")
    public String addMsg(@PathVariable("tenderId") Integer tenderId,
                         @PathVariable("size") String size,
                         @PathVariable("batch") String batch,
                         @PathVariable("address") String address) {
        suppliermsgService.addMsg(tenderId, size, batch, address);

        return "ok";
    }

    @PutMapping("hdUpdate/{id}")
    public String hdUpdate(@PathVariable("id") Integer id) {
        suppliermsgService.hdUpdate(id, "已收货");
        return "ok";
    }


}
